﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPages/MainTemplate.Master" AutoEventWireup="true" CodeBehind="ChangePasswordPage.aspx.cs" Inherits="AlexandriaPressWebsite.MasterPages.UserPages.ChangePasswordPage" %>
<asp:Content ID="Content1" ContentPlaceHolderID="mainDoc" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="formDoc" runat="server">
<h1>Change Password</h1>
<br />
    <asp:ChangePassword ID="ChangePassword1" runat="server">
        <ChangePasswordTemplate>
            <table border="0" cellpadding="1" cellspacing="0" 
                style="border-collapse:collapse;">
                <tr>
                    <td>
                        <table border="0" cellpadding="0">
                           
                            <tr>
                                <td align="right">
                                    <asp:Label ID="CurrentPasswordLabel" runat="server" 
                                        AssociatedControlID="CurrentPassword" CssClass="parag">Password:</asp:Label>
                                </td>
                                <td>
                                    <asp:TextBox ID="CurrentPassword" runat="server" TextMode="Password"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="CurrentPasswordRequired" runat="server" 
                                        ControlToValidate="CurrentPassword" ErrorMessage="Password is required." 
                                        ToolTip="Password is required." ValidationGroup="ChangePassword1">*</asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>
                                <td align="right">
                                    <asp:Label ID="NewPasswordLabel" runat="server" 
                                        AssociatedControlID="NewPassword" CssClass="parag">New Password:</asp:Label>
                                    
                                </td>
                                <td>
                                    <asp:TextBox ID="NewPassword" runat="server" TextMode="Password"></asp:TextBox>
                                    
                                    <asp:RequiredFieldValidator ID="NewPasswordRequired" runat="server" 
                                        ControlToValidate="NewPassword" ErrorMessage="New Password is required." 
                                        ToolTip="New Password is required." ValidationGroup="ChangePassword1">*</asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>
                                <td align="right">
                                    <asp:Label ID="ConfirmNewPasswordLabel" runat="server" 
                                        AssociatedControlID="ConfirmNewPassword" CssClass="parag">Confirm New Password:</asp:Label>
                                </td>
                                <td>
                                    <asp:TextBox ID="ConfirmNewPassword" runat="server" TextMode="Password"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="ConfirmNewPasswordRequired" runat="server" 
                                        ControlToValidate="ConfirmNewPassword" 
                                        ErrorMessage="Confirm New Password is required." 
                                        ToolTip="Confirm New Password is required." ValidationGroup="ChangePassword1">*</asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>
                                <td align="center" colspan="2">
                                    <asp:CompareValidator ID="NewPasswordCompare" runat="server" 
                                        ControlToCompare="NewPassword" ControlToValidate="ConfirmNewPassword" 
                                        Display="Dynamic" 
                                        ErrorMessage="The Confirm New Password must match the New Password entry." 
                                        ValidationGroup="ChangePassword1" CssClass="parag"></asp:CompareValidator>
                               </td>
        <tr>
        <td colspan="2">
            <asp:RegularExpressionValidator ID="newPasswordRegEx" runat="server" 
                ErrorMessage="Inlude at least one lowercase and one uppercase character and one digit. Minimum password length of 7." 
                ValidationExpression="^.*(?=.{7})(?=.*\d)(?=.*[a-zA-Z]).*$" 
                ControlToValidate="NewPassword" CssClass="parag"></asp:RegularExpressionValidator>
        </td>
        </tr>
                            <tr>
                                <td align="center">
                                    <asp:Button ID="ChangePasswordPushButton" runat="server" 
                                        CommandName="ChangePassword" Text="Change Password" 
                                        ValidationGroup="ChangePassword1" CssClass="genericButton" />
                                </td>
                                <td>
                                    <asp:Button ID="CancelPushButton" runat="server" CausesValidation="False" 
                                        CommandName="Cancel" Text="Cancel" onclick="CancelPushButton_Click" 
                                        CssClass="genericButton" />
                                </td>
                            </tr>    
                        </table>
                    </td>
                </tr>
            </table>
        </ChangePasswordTemplate>
        <SuccessTemplate>
            <table border="0" cellpadding="1" cellspacing="0" 
                style="border-collapse:collapse;">
                <tr>
                    <td>
                        <table border="0" cellpadding="0">
                            <tr>
                                <td align="center" class="parag">
                                    Change Password Complete</td>
                            </tr>
                            <tr>
                                <td align="center" class="parag">
                                    Your password has been changed!</td>
                            </tr>
                            <tr>
                            <td align = "center">
                                <asp:Button ID="DoneButton" runat="server" Text="Okay" CssClass="genericButton" 
                                    onclick="DoneButton_Click" />
                            </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
        </SuccessTemplate>
    </asp:ChangePassword>
    <br />
</asp:Content>
